<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ::placeholder{
            color:red;
        }
        ::-webkit-input-placeholder{
            color:red;
        }
        ::-moz-placeholder{
            color:red;
        }
        ::-ms-input-placeholder{
            color:red;
        }

        /* 单行文本省略 */
        div{
            /* 宽度必须 */
            width:200px;
            border:1px solid red;
            /* 文字不换行 */
            white-space:nowrap;
            /* 溢出隐藏 */
            overflow: hidden;
            /* 文本的最后展示三个点 */
            text-overflow: ellipsis;
        }

        /* 多行文本省略 */
        p{
            width:200px; 
            border:1px solid red;
            /* 溢出隐藏 */
            overflow: hidden;
            /* 文本的最后展示三个点 */
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }
    </style>
</head>
<body>
    <input type="text" placeholder="请输入用户名">

    <div>
        Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ea ipsam sit facere a numquam maiores consectetur? Enim, aliquid quisquam! Modi in fugit ullam aliquid consectetur, itaque earum necessitatibus nihil perferendis.
    </div>
    <p>
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsa, blanditiis facilis expedita tenetur nisi nobis minus tempora eius eum repudiandae, quis voluptatem! Nobis recusandae reprehenderit consequuntur quo ut voluptates necessitatibus!
    </p>
</body>
</html>